package com.segersten.othello.service.akka;

import akka.kernel.Bootable;

import com.segersten.othello.service.akka.game.BoardActorFactory;
import com.segersten.othello.service.akka.lobby.LobbyServiceActorFactory;
import com.segersten.othello.service.rest.JettyUtil;

public class Boot implements Bootable {

    AkkaUtil akkaUtil = new AkkaUtil();
    
	@Override
	public void startup() {
		try {
		    akkaUtil.initSystem(new LobbyServiceActorFactory(akkaUtil, new BoardActorFactory(akkaUtil)));
		JettyUtil.start("jetty-server.xml");
		} catch (Exception e) {
			throw new RuntimeException("Failed to boot", e);
		}
	}

	@Override
	public void shutdown() {
	    akkaUtil.shutdown();
	}
	
	public static void main(String [] args) {
		new Boot().startup();
	}

}
